define(['app'], function(app) {
	app.controller('classnewCtrl', function($scope,$http) {
		$('body').scrollTop(0)
		layui.use(['element','form'], function() {
			console.log("classnewCtrl")
			var element = layui.element;
			var form = layui.form;

			//监听提交
			form.on('submit(formDemo)', function(data) {
                console.log(data.field)
                $http({
                    url:"/OSRS/clazz/addClazz",
                    method:"POST",
                    data:JSON.stringify(data.field)
                }).then(function (res) {
                    alert(res.data)
                },function (err) {
                    alert("错误~添加失败!")
                })
				return false;
			});
            form.render();
		});
        $http({
            url:"/OSRS/clazz/getClazzType",
            method:"get"
        }).then(function (res) {
            console.log(res.data)
            $scope.clazzs = res.data
        },function (err) {
            console.log(err)
        })
	});
});